<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>任务</title>
    <link rel="stylesheet" href="/Public/css/gxxjkefu-normalize.css">
    <link rel="stylesheet" href="/Public/css/model.css">
    <link href="/Public/css/animate.css" rel="stylesheet">
    <link rel="stylesheet" href="/Public/css/toast.css">
    <link rel="stylesheet" type="text/css" href="/Public/css/xcConfirm.css"/>
    <style>
        .task_info{
            padding: 4% 5% 15%;
            line-height: 35px;
            color: black;
            background: #ffffff;
        }

        .task_div{
            margin: 0 auto;
            border: solid 1px #ececec;
            border-left:solid 10px #ececec;
            padding: 2% 4% 2% 2%;
        }
        .task_div span{
            display: block;
        }
        .task_div .task_user span{
            display: inline-block;
        }
        textarea{
            background: #f5f5f5;
            border: none;
            padding: 1%;
        }
        .submit_btn{
            width: 200px;
            height: 40px;
            border: none;
            color: white;
            background: #ff815a;
            margin: 20px 0;
            position: absolute;
            right: 0;
            bottom: 0;
        }
        .comment_div{
            border-top: solid #f2f2f2 2px;
            padding: 20px 0;
            margin-top: 20px;
        }
    </style>
    <script src="/Public/js/jquery-3.2.1.js"></script>
</head>
<body>
<div  class="scrollbar animated fadeInRight" id="style-1">
<div id="main_C"  >
    <div class="title_info">
        <span>任务</span>
    </div>
    <div class="white_bgColor task_info">
        <div class="task_div">
            <div class="task_user">
                <span>任务名称：<{$data.title}></span>
                <span style="float: right">状态：<span class="red_color"><{$data.status_s}></span></span>
            </div>
            <span>任务时间：<{$data.task_time}></span>
            <if  condition="$data.status eq 1">

                <if condition="$data.over_date eq 1">
                    <span>提醒：任务已超时<{$data.day}>天<{$data.hour}>小时</span>
                    <else/>
                    <span>提醒：距离任务还有<{$data.day}>天<{$data.hour}>小时</span>
                </if>


            </if>

            <span>备注：<{$data.remark}></span>
        </div>
        <div style="margin-top:30px;position: relative;padding-bottom: 80px">
            <p>任务备份</p>
            <textarea name="a"  id="content" style="width:98%;height:210px;"></textarea>
            <input type="button"value="提交" onclick="feedback()" class="submit_btn"/>
        </div>
        <p style="margin-top: 20px">历史备注：</p>
        <div id="feedback_list">
       <volist name="feedback" id="vo">
           <div class="comment_div">
               <span><{$vo.content}></span>
               <span style="float: right"><{$vo.ctime}>   记录人：<{$vo.name}> （0<{$vo.id}>）</span>
           </div>
       </volist>
        </div>
    </div>
</div>
</div>
<script src="/Public/js/jquery-3.2.1.js"></script>
<script src="/Public/js/xcConfirm.js" type="text/javascript" charset="utf-8"></script>
<script src="/Public/laydate/laydate.js"></script>
<script src="/Public/js/toast.js"></script>
<script src="/Public/js/content.js?v=1.0.0"></script>



<script>
   function feedback() {
       var task_id="<{$task_id}>";
       var url="<{$SERVER_NAME}>/User/task_pull";
       var content=$('#content').val();
       if(content=="" || content.replace(/(^s*)|(s*$)/g, "").length == 0){

           $('#main_C').toast({
               content: '请填写备注！',
               duration: 1000
           });
//           window.wxc.xcConfirm('请填写备注', window.wxc.xcConfirm.typeEnum.info);
           return false;
       }

       var txt = "确定提交？";
       var option = {
           title: "任务提交",
           btn: parseInt("0011", 2),
           onOk: function () {

               $.post(url, {
                   task_id: task_id,
                   content: content
               }, function (data) {
                   console.log('121212', data);
                   if (data.code == '1001') {//获取历史备注

                       $('#main_C').toast({
                           content: '提交成功！',
                           duration: 1000
                       });
//                       window.wxc.xcConfirm(data.result, window.wxc.xcConfirm.typeEnum.success);
                       $.post("<{$SERVER_NAME}>/User/task_feedback",{task_id: task_id},function (data) {
                              if(data.code=='1001'){

                                  window.location.reload();
                                  window.parent.get_task();
//                                  $("#content").val("");
//                                  var s="";
//                                  var obj=data.result;
//                                  console.log(obj);
//                                  for (var i=0;i<obj.length;i++){
//                                      s+="  <div class='comment_div'> <span>"+obj[i].content+"</span> <span style='float: right'>"+obj[i].ctime+"  记录人："+obj[i].name+"（0"+obj[i].id+"）</span> </div>";
//                                  }
                              }
                              document.getElementById("feedback_list").innerHTML=s;
                       });
                   } else {
                       window.wxc.xcConfirm(data.result, window.wxc.xcConfirm.typeEnum.success);
                   }
               });
           }

       }
       window.wxc.xcConfirm(txt, "custom", option);


   }



</script>
</body>
</html>